<?php include "conn.php";?>
<?php
$status=1;
if(isset($_POST["signup-username"])){$usrName =trim($_POST["signup-username"]);$status=2;}else{$usrName="";$status=1;}
if(isset($_POST["signup-password"])){$usrPwd =trim($_POST["signup-password"]);
    $usrPwd=substr(md5($usrPwd),8,16);
}else{$usrPwd="";}
if(isset($_POST["signup-email"])){$userEmail =trim($_POST["signup-email"]);}else{$userEmail="";}
if($status==1){
    GoLink("error.html");
}else{
    $conn=new Mysql();
    $sql="insert into d_guest(g_name,g_psw,g_email,adate) values('$usrName','$usrPwd','$userEmail','".now()."')";
    if($conn->query($sql)){
        $uid=$conn->lastId();
        $_SESSION["UserID"] = $uid;
        $_SESSION["DUserName"] = $usrName;
       GoLink("user.php");
    }else{
        GoLink("error.html");
    }
}
?>